﻿CREATE VIEW [dbo].[vw_sheethistory]
AS
   SELECT TOP 100000
          dbo.Repairs.WordOrderId,
          a.fullName AS oper,
          CONVERT (VARCHAR (200), dbo.SheetHistory.OpDate, 20) AS opdate,
          dbo.SheetHistory.remark AS remark,
           operation.[Desc] as [desc]
     FROM SheetHistory
          INNER JOIN Repairs ON dbo.Repairs.Id = dbo.SheetHistory.SheetId
          INNER JOIN [User] a ON a.Id = dbo.SheetHistory.OperId
          INNER JOIN Operation ON dbo.SheetHistory.OpId = dbo.Operation.OpId
   ORDER BY dbo.SheetHistory.OpDate DESC